<?php defined('BASEPATH') OR exit('No direct script access allowed');


class Contact extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();

        $this->load->helper(array('form', 'url'));
        $this->load->database();

        //加载模块
        $this->load->model('contact_model');

        //调试模式
        //$this->output->enable_profiler(TRUE);
    }

    public function index()
    {
        $data['title'] = 'Li Lijie - 联系我';
        $this->load->view('home/header', $data);
        $this->load->view('home/contact');
        $this->load->view('home/footer');
    }

    public function add()
    {
        //获取表单信息
        $data = array(
            'name' => $this->input->post('name'),  //姓名
            'email' => $this->input->post('email'),  //邮箱地址
            'title' => $this->input->post('title'),  //标题
            'content' => $this->input->post('content'),  //分类
        );
        //数据库操作
        $this->contact_model->add($data);
        jump('/contact','我将尽快邮件给您回复，谢谢！');  //跳转
    }
}